<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>医嘱详情</title>
		<link rel="stylesheet" href="../css/reset.css">
		<link rel="stylesheet" type="text/css" href="../lib/layui/css/layui.css" />
		<style>
			.gzjl td{
				width: 150px;
				text-align: center;
			}
			.yzxq td{
				width: 150px;
				text-align: center;
			}
			.yzxq th{
				width: 150px;
			}
			.gzjl th{
				width: 150px;
			}
		</style>
	</head>
	<body>
		<div class="ydhlui-detail-title clearfix">
			<div class="ydhlui-back fl"><a href="javascript:history.go(-1)">返回</a></div>
			<div class="ydhlui-tit fl">001床-张丽丽&nbsp;&nbsp;&nbsp;&nbsp;住院号：0003902（1）</div>
		</div>

		<div id="view"></div>

	</body>
	<script id="demo" type="text/html">
		<!-- 医嘱详情 -->
		<div class="yzxq">
			<h3>医嘱详情</h3>
			<div class="border-box">
				<div class="tit">
					<span>下达时间：{{d.data.startTime}}</span>
					<span>停嘱时间:{{d.data.stopTime}}</span>
					<span>审核时间:{{}}</span>
				</div>
				<div class="con">
					<table border="0" cellspacing="" cellpadding="">
						<tr>
							<th>医嘱内容</th>
							<th>开嘱医生</th>
							<th>频次</th>
							<th>剂量</th>
							<th>单位</th>
							<th>医嘱状态</th>
							<th>停嘱医生	</th>
							<th>停嘱护士</th>
							<th>医生说明</th>
						</tr>
						<tr>
							<td>{{d.data.content}}</td>
							<td>{{d.data.ord_user}}</td>
							<td>{{d.data.phfreq}}</td>
							<td>{{d.data.doseqty}}</td>
							<td>{{d.data.dose_unit}}</td>
							<td>{{d.data.orderStatus}}</td>
							<td>{{d.data.stopDoctor}}</td>
							<td>{{d.data.stopUser}}</td>
							<td>{{d.data.instr}}</td>
						</tr>
					</table>
				</div>
				<div class="foot">
					<p>审核护士：{{d.data.checkNurse}}</p>
				</div>
			</div>
		</div>
		
		<!-- 工作记录 -->
		<div class="gzjl">
			<h3>工作记录</h3>
			{{#  layui.each(d.data.records, function(index, records){ }}
				<h2>{{records.date}}</h2>
				<table border="0" cellspacing="" cellpadding="">
					<tr>
						<th>任务名称</th>
						<th>任务转态</th>
						<th>实际执行时间</th>
						<th>执行人</th>
						<th>取消原因</th>
						<th>病情记录</th>
					</tr>
				</table>
				{{#  layui.each(records.record, function(index, record){ }}
					<table border="0" cellspacing="" cellpadding="">
						<tr>
							<td>{{record.executeDate}}</td>
							<td>{{record.action}}</td>
							<td>{{record.executeName}}</td>
							<td>{{record.excuteDesc}}</td>
							<td>{{record.userName}}</td>
							<td>{{record.execute}}</td>
							</tr>
					</table>
				{{#  }); }}
				{{#  if(records.record.length === 0){ }}
				  无数据
				{{#  } }} 
			{{#  }); }}
			{{#  if(d.data.records.length === 0){ }}
			无数据
			{{#  } }} 
		</div>
	</script>
	
	<script src="../js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/global.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		layui.use(['laypage', 'form', 'element', 'table', 'laytpl'], function() {
			var laytpl = layui.laytpl;
			var element = layui.element;
			var laypage = layui.laypage;
			var form = layui.form;
			var table = layui.table;

			function GetRequest() {
				var url = location.search; //获取url中"?"符后的字串
				console.log(url);
				var theRequest = new Object();
				if (url.indexOf("?") != -1) {
					var str = url.substr(1);
					strs = str.split("&");
					for (var i = 0; i < strs.length; i++) {
						theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
					}
				}
				return theRequest;
			}

			// 请求参数
			var param = JSON.stringify({
				"body": {
					"sourceId": GetRequest().id
				}
			});
			//请求
			$.ajax({
				'type': 'post',
				'url': '/service-nursingwork/doctorAdvice/adviceDetail',
				'data': param,
				'dataType': 'json',
				'contentType': "application/json",
				'success': function(data) {
					console.log(data);
					// console.log(data.data.records[0].record);
					//console.log(typeof(data.data.startTime));

					var getTpl = demo.innerHTML,
						view = document.getElementById('view');
					laytpl(getTpl).render(data, function(html) {
						view.innerHTML = html;
					});

					//表格

				},
				'error': function(res) {
					console.log(res);
				}
			});
		})
	</script>
</html>
